<div class="logo">
	<a href="<?php echo Yii::app()->homeUrl; ?>"><?php echo CHtml::image(Yii::app()->baseUrl.'/images/logo_big.png'); ?></a>
</div>

<div id="login">
	<div class="login-form">
<?php if(Yii::app()->user->isGuest) { ?>
		<div class="login-btn">
			<ul>
				<li><?php echo CHtml::link(Yii::t('label','LOG IN'),'#',array('onClick'=>'login()')); ?></li>
				<li><?php echo CHtml::link(Yii::t('label','REGISTER'),array('user/register')); ?></li> 
			</ul>
		</div>
		<form id="login-form" action="<?php echo Yii::app()->createUrl('site/login'); ?>">
		<div class="login-item">
			<div class="login-item-text"><?php echo Yii::t('labels','EMAIL'); ?></div>
			<input name="LoginForm[username]" type="text" class="text1" id="LoginForm_username" size="15px"/>    
		</div>
		<div class="login-item">
			<div class="login-item-text"><?php echo Yii::t('labels','PASSWORD'); ?></div>
			<input name="LoginForm[password]" type="password" id="LoginForm_password" class="text2" size="15px"/>
		</div>
		</form>
<?php } else { ?>
		<div class="login-btn">
			<ul>
				<li><?php echo CHtml::link(Yii::app()->user->name,'#'); ?></li>
				<li><?php echo CHtml::link(Yii::t('label','LOG OUT'),array('site/logout')); ?></li> 
			</ul>
		</div>
<?php } ?>
	</div>
</div><!------end login----->

<div class="menu">
	<?php $this->widget('zii.widgets.CMenu',array(
		'items'=>$items
	)); ?>
</div><!---end menu------>

<script>
function login() {
	var errorStr = '';
	var username = $('#LoginForm_username').val();
 	var password = $('#LoginForm_password').val();
 	
	if(username == '')
		alert('Bạn chưa nhập username/email');
	else if(password == '')
		alert('Bạn chưa nhập password');
	else {
		$.post('<?php echo Yii::app()->createUrl('site/login'); ?>',$('#login-form').serialize(),function(url){
			location.replace(url);
			//alert(url);
		});
		//$('#login-form').submit();
	}
	
	
}
</script>